package cn.com.scitc.user;

import cn.com.scitc.dao.ManagerDao;
import cn.com.scitc.model.Manager;
import cn.com.scitc.server.MyMd5;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;

@WebServlet(name = "UserEditServlet",urlPatterns = "/manager/user/edit")
public class UserEditServlet extends HttpServlet {

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        try {
            String id = request.getParameter("id");
            ManagerDao dao = new ManagerDao();
            Manager manager = dao.findById(Integer.parseInt(id));
            request.setAttribute("model",manager);
            request.getRequestDispatcher("/WEB-INF/manager/user/edit.jsp").forward(request,response);
        } catch (Exception e) {
            e.printStackTrace();
            response.sendRedirect("list");
        }

    }
}
